<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>usersUpdate - Swim System</title>
<link rel="shortcut icon" href="favicon.ico">
<link href="/swimpool-ssm/back/resources/css/bootstrap.min.css?v=3.3.5"
	rel="stylesheet">
<link
	href="/swimpool-ssm/back/resources/css/font-awesome.min.css?v=4.4.0"
	rel="stylesheet">
<link href="/swimpool-ssm/back/resources/css/animate.min.css"
	rel="stylesheet">
<link href="/swimpool-ssm/back/resources/css/style.min.css?v=4.0.0"
	rel="stylesheet">

<script src="/swimpool-ssm/back/resources/js/jquery.min.js?v=2.1.4"></script>
<script src="/swimpool-ssm/back/resources/js/bootstrap.min.js?v=3.3.5"></script>
<script src="/swimpool-ssm/back/resources/js/content.min.js?v=1.0.0"></script>
<script
	src="/swimpool-ssm/back/resources/js/plugins/validate/jquery.validate.min.js"></script>
<script
	src="/swimpool-ssm/back/resources/js/plugins/validate/messages_zh.min.js"></script>
<script
	src="/swimpool-ssm/back/resources/js/demo/form-validate-demo.min.js"></script>
<script src="/swimpool-ssm/js/util.js"></script>
</head>

<body class="gray-bg">
	<div class="wrapper wrapper-content animated">
		<div class="row">
			<div class="col-sm-11">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>Users Update</h5>
						<div class="ibox-tools">
							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
							</a> <a class="dropdown-toggle" data-toggle="dropdown"
								href="form_basic.html#"> <i class="fa fa-wrench"></i>
							</a>
						</div>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="form">
							<input type="hidden" id="id" name="id">
							<div class="form-group">
								<label class="col-sm-3 control-label">email：</label>
								<div class="col-sm-8">
									<input id="email" name="email" minlength="2" type="text" readonly="readonly"
										class="form-control" required="" aria-required="true">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">nickName：</label>
								<div class="col-sm-8">
									<input id="nickName" name="nickName" minlength="2" type="text" readonly="readonly"
										class="form-control" required="" aria-required="true">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">Name：</label>
								<div class="col-sm-8">
									<input id="name" name="name" minlength="2" type="text" readonly="readonly"
										class="form-control" required="" aria-required="true">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">phone：</label>
								<div class="col-sm-8">
									<input id="phone" type="number" class="form-control" name="phone" readonly="readonly"
										required="" aria-required="true">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">sex：</label>
								<div class="col-sm-8">
									<select name="sex" id="sex" class="form-control" disabled="disabled">
										<option value="0">unknow</option>
										<option value="1">boy</option>
										<option value="2">girl</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">loginCount：</label>
								<div class="col-sm-8">
									<input id="loginCount" name="loginCount" minlength="2" type="text" readonly="readonly"
										class="form-control" required="" aria-required="true">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">school：</label>
								<div class="col-sm-8">
									<input id="school" name="school" minlength="2" type="text" readonly="readonly"
										class="form-control" required="" aria-required="true">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">status：</label>
								<div class="col-sm-8">
									<select name="status" id="status" class="form-control">
										<option value="1">enable</option>
										<option value="0">disable</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-4 col-sm-offset-3">
									<button class="btn btn-primary" type="button"
										onclick="formSubmit()">submit</button>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-4 col-sm-offset-3">
									<span id="info"></span>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
<script type="text/javascript">
	/**
		提交
	*/
	function formSubmit()
	{
		var param = $("#form").serialize();
		
		$.post(
			rootPath + "/users/usersUpdate.mvc",
			param + "&operType=status",
			function(data)
			{
				$("#info").html(data.info);
			},
			"json"
		);
		return false ; 
	}
	
	/* 根据id查询数据 */
	function getDataById(id)
	{
		$.post(
			rootPath + "/users/usersInfo.mvc",
			"id=" + id,
			function(data)
			{
				console.info("====" + data) ; 
				var dataOne = data.data.one ;
				/* 循环数据 */
				for(var temp in dataOne)
				{
					var tempObj = $("#" + temp) ;
					//console.info(temp + "=====" + tempObj.length + "====" + tempObj.size + "====" + dataOne[temp])
					if(tempObj.length > 0 )
					{
						/* 赋值 */
						tempObj.val(dataOne[temp]);
					}
				}
			},
			"json"
		);
		return false ; 
	}
	
	/* 获取id */
	var id = urlParam("id") ; 
	getDataById(id) ;
</script>